<template>
  <div v-auths="['produceCount']">
    <div class="topBox">
      <p class="name">生产统计</p>
    </div>
    <div class="list">
      <div class="item">
        <p class="name">生产单总数</p>
        <p class="value">
          {{ countData.productYearNum ?? 0 }}
        </p>
      </div>
      <div class="item">
        <p class="name">生产单月新增</p>
        <p class="value">
          {{ countData.produceMonthNum ?? 0 }}
        </p>
      </div>
      <div class="item">
        <p class="name">送货单总数</p>
        <p class="value">
          {{ countData.deliverYearNum ?? 0 }}
        </p>
      </div>

      <div class="item">
        <p class="name">送货月新增</p>
        <p class="value">
          {{ countData.deliverMonthNum ?? 0 }}
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'produceCount',
  title: '生产统计',
  icon: "el-icon-s-data",
  description: "生产统计信息展示",
  data () {
    return {
      countData: {}
    }
  },
  mounted () {
    this.getProduceCountData()
  },
  methods: {
    async getProduceCountData () {
      let { data } = await this.$API.produce.deliver.getProduceCountData.get()
      this.countData = data
    }
  }

}
</script>

<style lang='scss' scoped>
.topBox {
  display: flex;
  align-items: baseline;
  .name {
    margin-right: 10px;
    font-weight: 600;
    font-size: 18px;
  }
}
.list {
  display: flex;
  justify-content: flex-start;
  margin: 20px 0;
}
.item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-basis: calc(100% / 4);
  min-width: 200px;
  height: 130px;
  margin-right: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0px 0px 8px 0px rgba(13, 0, 66, 0.1);

  &:last-child {
    margin-right: 0;
  }
  .info {
    margin-left: 6px;
  }

  .name {
    margin-bottom: 6px;
    font-size: 16px;
    color: #666;
  }
  .value {
    font-weight: 600;
    font-size: 28px;
  }
}
</style>
